{{#ui/ui-toolbar dark=false light=false raised=false large=false bordered=false}}
	{{#if (eq appMeta.edition constants.Product.EnterpriseEdition)}}
		{{#if permissions.documentEdit}}
			{{#ui/ui-toolbar-dropdown label=(localize 'actions') arrow=true}}
				{{#attach-popover class="ember-attacher-popper" hideOn="click clickout" showOn="click" isShown=false}}
					<ul class="menu">
						<li class="item" {{action "onShowRequestContributionModal"}} role="button" tabindex="0">{{localize 'doc_request_contribution'}}</li>
						<li class="item" {{action "onShowRequestFeedbackModal"}} role="button" tabindex="0">{{localize 'doc_request_feedback'}}</li>
						<li class="item" {{action "onShowRequestReadModal"}} role="button" tabindex="0">{{localize 'doc_request_read'}}</li>
						{{#if (eq document.lifecycle constants.Lifecycle.Draft)}}
							<li class="divider"/>
							<li class="item" {{action "onShowPublishModal"}} role="button" tabindex="0">{{localize 'doc_request_publication'}}</li>
						{{/if}}
						<li class="divider"/>
						<li class="item" {{action "onShareModal"}} role="button" tabindex="0">{{localize 'doc_secure_share'}}</li>
					</ul>
				{{/attach-popover}}
			{{/ui/ui-toolbar-dropdown}}
		{{/if}}
	{{/if}}

	{{#ui/ui-toolbar-dropdown label=(localize 'content') arrow=true}}
		{{#attach-popover class="ember-attacher-popper" hideOn="click clickout" showOn="click" isShown=false}}
			<ul class="menu">
				{{#if pinState.isPinned}}
					<li class="item" {{action "onUnpin"}} role="button" tabindex="0">{{localize 'bookmark_remove'}}</li>
					<li class="divider"/>
				{{else if session.authenticated}}
					<li class="item" {{action "onPin"}} role="button" tabindex="0">{{localize 'bookmark'}}</li>
					<li class="divider"/>
				{{/if}}
				<li class="item" {{action "onShowPrintModal"}} role="button" tabindex="0">{{localize 'print'}}</li>
				<li class="item" {{action "onExport"}} role="button" tabindex="0">{{localize 'download'}}</li>
				{{#if (or permissions.documentAdd permissions.documentCopy)}}
					<li class="divider"/>
					{{#if permissions.documentAdd}}
						<li class="item" {{action "onShowTemplateModal"}} role="button" tabindex="0">{{localize 'template'}}</li>
					{{/if}}
					{{#if permissions.documentCopy}}
						<li class="item" {{action "onShowDuplicateModal"}} role="button" tabindex="0">{{localize 'copy'}}</li>
					{{/if}}
				{{/if}}
				{{#if permissions.documentDelete}}
					<li class="divider"/>
					<li class="item red" {{action "onShowDeleteModal"}} role="button" tabindex="0">{{localize 'delete'}}</li>
				{{/if}}
			</ul>
		{{/attach-popover}}
	{{/ui/ui-toolbar-dropdown}}

	{{#if (or showActivity showRevisions)}}
		{{#ui/ui-toolbar-dropdown label=(localize 'history') arrow=true}}
			{{#attach-popover class="ember-attacher-popper" hideOn="click clickout" showOn="click" isShown=false}}
				<ul class="menu">
					{{#if showActivity}}
						{{#link-to "document.activity" class="item"}}{{localize 'activity'}}{{/link-to}}
					{{/if}}
					{{#if showRevisions}}
						{{#link-to "document.revisions" class="item"}}{{localize 'revisions'}}{{/link-to}}
					{{/if}}
				</ul>
			{{/attach-popover}}
		{{/ui/ui-toolbar-dropdown}}
	{{/if}}

	{{#if permissions.documentEdit}}
		{{ui/ui-toolbar-icon icon=constants.Icon.Settings color=constants.Color.Green tooltip=(localize 'settings') linkTo="document.settings"}}
	{{/if}}
{{/ui/ui-toolbar}}

<div id="document-template-modal" class="modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">{{localize 'template_save'}}</div>
			<div class="modal-body">
				<form onsubmit={{action "onSaveTemplate"}}>
					<div class="form-group">
						<label for="new-template-name">{{localize 'name'}}</label>
						{{input id="new-template-name" value=saveTemplate.name type="text" class="form-control mousetrap" placeholder=""}}
					</div>
					<div class="form-group">
						<label for="new-template-desc">{{localize 'description'}}</label>
						{{textarea id="new-template-desc" value=saveTemplate.description class="form-control" rows="5"}}
						<small class="form-text text-muted">{{localize 'template_desc_explain'}}</small>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				{{ui/ui-button color=constants.Color.Gray light=true label=(localize 'cancel') dismiss=true}}
				{{ui/ui-button-gap}}
				{{ui/ui-button color=constants.Color.Green light=true label=(localize 'save') onClick=(action "onSaveTemplate")}}
			</div>
		</div>
	</div>
</div>

<div id="document-print-modal" class="modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">{{localize 'print'}}</div>
			<div class="modal-body">
				<p>{{localize 'print_explain'}}</p>
				{{#each pages as |item|}}
					{{#ui/ui-checkbox selected=item.printSelected}}
						{{item.page.numbering}}. {{item.page.title}}
					{{/ui/ui-checkbox}}
				{{/each}}
			</div>
			<div class="modal-footer">
				{{ui/ui-button color=constants.Color.Gray light=true label=(localize 'cancel') dismiss=true}}
				{{ui/ui-button-gap}}
				{{ui/ui-button color=constants.Color.Green light=true label=(localize 'print') onClick=(action "onPrintSelection")}}
			</div>
		</div>
	</div>
</div>

<div id="document-delete-modal" class="modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">{{localize 'delete'}}</div>
			<div class="modal-body">
				<p>{{localize 'doc_delete_confirm'}}</p>
			</div>
			<div class="modal-footer">
				{{ui/ui-button color=constants.Color.Gray light=true label=(localize 'cancel') dismiss=true}}
				{{ui/ui-button-gap}}
				{{ui/ui-button color=constants.Color.Red light=true label=(localize 'delete') onClick=(action "onDocumentDelete")}}
			</div>
		</div>
	</div>
</div>

<div id="document-duplicate-modal" class="modal" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">{{localize 'duplicate'}}</div>
			<div class="modal-body">
				<form onsubmit={{action "onDuplicate"}}>
					<div class="form-group">
						<label for="duplicate-name">{{localize 'name'}}</label>
						{{input id="duplicate-name" value=duplicateName type="text" class="form-control mousetrap" placeholder=""}}
					</div>
				</form>
			</div>
			<div class="modal-footer">
				{{ui/ui-button color=constants.Color.Gray light=true label=(localize 'cancel') dismiss=true}}
				{{ui/ui-button-gap}}
				{{ui/ui-button color=constants.Color.Green light=true label=(localize 'duplicate') onClick=(action "onDuplicate")}}
			</div>
		</div>
	</div>
</div>
